import hashlib
import time


#用于加密
class  Transfer():
    def __init__(self):
        print("Transfer init")

    def SHA256(self,dataOne,dataTwo):
        """
         use simple SHA256  （not salt)
        :param dataOne:
        :param dataTwo:
        :return:
        """
        data=dataOne+dataTwo
        result=hashlib.sha256(data.encode(encoding='UTF-8')).hexdigest()
        return result


    def verifyData(self,data,md5Data):
        """
        verify data true
        :param data: not SHA256 data
        :param md5Data: SHA256 data
        :return: data is right return true .Or return false
        """
        newData=""
        for i in data:
            newData+=i
        dataToMd4=hashlib.sha256(newData.encode(encoding='UTF-8')).hexdigest()
        if(newData==dataToMd4):
            return True
        else:
            return False
